<#list "${content.items.controller.packageName}"?split(".") as package>
    <#if !package_has_next>
        <#assign assign_package = package>
    </#if>
</#list>
<#assign tableName = content.content.tableName>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    <title>修改页面</title>
    #set(ibp.dto.sys.T00_userDTO currUser)
    ${r'${include("/ibp/httl/include/include_css.httl","UTF-8")}'}
    ${r'${include("/ibp/httl/include/include_js.httl","UTF-8")}'}
    <style></style>
</head>
<body>
<cus-template>
    <div class="clearfix">
        <form class="cus-form">
            <div layout-padding id="wrap">
                <div layout="row" class="form-box">
                    <div flex layout="row" layout-wrap layout-padding>
                        <!-- 表单内容 -->
                        <#list content.content.fields as item>
                        <#if item.primary != true>
                        <#if item.length <500>
                        <div class="form-item important" flex="50">
                            <label><#if item.fieldRemark??>${item.fieldRemark}</#if></label>
                            <div flex>
                            <#if item.fieldName?lower_case?contains("time")>
                                <input type="text" class="form-control input-sm" name="${item.fieldName}" id="${item.fieldName}" maxlength="${item.length}" data-type="dateTimePicker"  data-auto-update-input="false"  ui-daterangepicker  required/>
                            <#elseif item.fieldName?lower_case?contains("date")>
                                <input type="text" class="form-control input-sm" name="${item.fieldName}" id="${item.fieldName}" maxlength="${item.length}" data-type="datePicker"  data-auto-update-input="false"  ui-daterangepicker required/>
                            <#else>
                                <input type="text" class="form-control input-sm" name="${item.fieldName}" id="${item.fieldName}" maxlength="${item.length}"  required/>
                            </#if>
                            </div>
                        </div>
                        <#else>
                        <div class="form-item important" flex="50"  flex-gt-sm="100">
                            <label><#if item.fieldRemark??>${item.fieldRemark}</#if></label>
                            <div flex>
                                <textarea class="form-control input-sm" rows="3" ui-textarea name="${item.fieldName}" id="${item.fieldName}" maxlength="${item.length}" required></textarea>
                            </div>
                        </div>
                        </#if>
                        </#if>
                        </#list>


                    </div><!--row-->
                </div><!--form-box-->
                <!-- ********************************隐藏域start**************************************** -->
                <#if content.content.primaryField?? && content.content.primaryField?size gt 0>
                <!-- 主键id -->
                <input type="hidden" name="${content.content.primaryField[0].fieldName}" id="${content.content.primaryField[0].fieldName}"/>
                </#if>
                <!-- ===============================附件管理相关参数================================= -->
                <input type="hidden" name="businesskey" id="businesskey"/>
                <input type="hidden" name="businesskey_attachtype" id="businesskey_attachtype" value="${content.content.tableName}"/>
                <input type="hidden" name=" attachSize " id="attachSize" value="5" />
                <input type="hidden" name="attachFormat" id="attachFormat" value="txt,docx,xlsx,doc,xls,pdf"/>
                <!-- ====================================end======================================-->
                <!-- ********************************隐藏域end**************************************** -->
                <!-- 引入附件管理页面 -->
                ${r'${include("/ibp/httl/attach/include_attach.httl","UTF-8")}'}
                <!--按钮-->
                <div class="form-actions text-right">
                    <button class="btn btn-success form-btn">
                        <i class="fi fi-save"></i> 保存
                    </button>
                </div>

            </div><!--wrap-->
        </form>
    </div><!--clearfix-->
</cus-template>
<br>
<script cus-template-script>
    //表单回显
    $(".cus-form").setForm(${r'$!{'}${content.content.tableName}.encodeJson${r'}'});
    //初始化进入
    $(function () {});
    //表单验证
    $(".cus-form").validate({
        submitHandler: function (form) {
            var openurl =  ${r'"${appName}'}/${assign_package}/${content.content.tableName}/update${tableName?cap_first}.ajax";
            $.ajax({
                url: openurl,
                data: $(form).serializeArray(),
                type: 'post',
                dataType: 'json',
                success: function (data) {
                    if ("1" == data.messageFlag) {
                        var popLayerWindow = getPopLayerWindow();
                        popLayerWindow.popLayer.remove();
                        popLayerWindow.queryObjList();
                        popLayerWindow.successMsg(data.message);
                        //保存附件信息
                        saveT01_attachmentAllDo(data.businesskey);
                    } else {
                        layer.alert(data.message);
                    }
                }
            });
        }, ignore: ":hidden"
    });

</script>
</body>
</html>